package co.fitstart.admin.dao;

import java.util.List;

import com.demo2do.core.persistence.annotation.Dynamic;
import com.demo2do.core.persistence.annotation.Execute;
import com.demo2do.core.persistence.annotation.Limit;
import com.demo2do.core.persistence.annotation.Query;
import com.demo2do.core.persistence.annotation.Variable;

import co.fitstart.entity.finance.Receivables;
import co.fitstart.entity.finance.ReceivablesExportRecord;

@Dynamic("hibernate")
public interface ReceivablesDao {
    
    /**
     * 
     * @param export
     * @param beginIndex
     * @param maxResult
     * @return
     */
    @Limit
    @Query("FROM Receivables WHERE export = :export")
    public List<Receivables> list(@Variable("export") boolean export, @Variable("beginIndex") int beginIndex, @Variable("maxResult") int maxResult);

    /**
     * 
     * @param export
     * @return
     */
    @Query("FROM Receivables WHERE export = :export")
    public List<Receivables> list(@Variable("export") boolean export);
    
    /**
     * 
     * @param ids
     */
    @Execute("UPDATE Receivables SET export = true WHERE id in (:ids)")
    public void export(@Variable("ids") List<Long> ids);
    
    /**
     * 
     * @param export
     * @return
     */
    @Limit
    @Query("FROM ReceivablesExportRecord")
    public List<ReceivablesExportRecord> listExportRecord(@Variable("beginIndex") int beginIndex, @Variable("maxResult") int maxResult);

}
